var vueApp = new Vue({
  el: '#app',
  data: function () {
    return {
    	uploadUrl:"../../pub/attach/uploadsingle",
    	fileFlag:true,
    	fileUploadPercent:0,
        fileInfo:{},
        data:{},
        file: null,
      };
  },
  mounted: function () {
   
	  this.initData();
  },
  methods: {
    initData:function(){
     
    },
    
    uploadFile:function() {    
    	

    	var fileData=new FormData();
    	fileData.append("file",this.file);
    	fileData.append("fileName","11133.mp4");
    	fileData.append("modeName","上传");
    	fileData.append("folder","file/other");
    	fileData.append("fileType","mp4");
    	fileData.append("fileSize","12323232");
    	axios.post( this.uploadUrl, fileData,{ 
            headers: {"content-type": "multipart/form-data"}
        }).then(function(res) {
			
			console.log(res);
			
		});		
     },
   
    beforeUploadFile: function(file) {
    	this.data.fileName="1133.mp4";
        this.data.modeName="上传";
    	this.file=file;
        const isLt10M = file.size / 1024 / 1024  < 500;
        if (['video/mp4', 'video/ogg', 'video/flv','video/avi','video/wmv','video/rmvb'].indexOf(file.type) == -1) {
            this.$message.error('请上传正确的视频格式');
            return false;
        }
        if (!isLt10M) {
            this.$message.error('上传视频大小不能超过500MB哦!');
            return false;
        }

    },
    
    uploadFileProcess: function(event, file, fileList){
        this.fileFlag = true;
        this.fileUploadPercent = file.percentage.toFixed(0);
       
    },
    handleFileSuccess: function (res, file) {   
    	 this.fileFlag = false;
    	 this.fileUploadPercent = 0;
    	
    },
    
    showError: function(info){
        var i = (info==undefined?"加载数据错误":info);
        this.$alert(i, '系统错误', {
             confirmButtonText: '确定'
        }); 
    },

  },
  watch:{
     
  }
  
})